package ServerApp;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

// test 
public class Meeting implements Serializable {

	private String name;
	private String location;
	private Date date;
	private String details;

	public Meeting() {

	}

	public Meeting(String name, String location, Date date, String details) {
		this.name = name;
		this.location = location;
		this.date = date;
		this.details = details;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getLocation() {
		return location;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getDate() {
		return date;
	}

	public void setDetails(String details) {
		this.details = details;
	}

	public String getDetails() {
		return details;
	}
	
	@Override
	public boolean equals(Object obj) {
		Meeting m = (Meeting) obj;
		if(m.getName().equals(name) &&
			m.getLocation().equals(location) &&
			m.getDetails().equals(details) &&
			m.getDate().equals(date))
			return true;
		else return false;
	}
	
	@Override
	public String toString() {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		String date = cal.get(Calendar.DAY_OF_MONTH) + "."
				+ cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR);
		return "Meeting: " + date + " " + name;
	}

}
